<%--
  Created by IntelliJ IDEA.
  User: YanHilin
  Date: 2020/4/20
  Time: 19:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>鲜花产品页面</title>
    <base href="http://localhost:8080/onlineflower/">
    <%@include file="/page/comment/head.jsp"%>
    <style type="text/css">
        .con{
            float: left;
            margin-bottom: 2px;
            margin-left: 25px;
            font-size: 16px;
            color: #0b2e13;
        }
        #pageN{
            margin-top: 3px;
            display:flex;
            align-items:center;
            justify-content:center;
        }
    </style>
    <script src="static/js/jquery-3.4.1.js"></script>
</head>
<body>
<%@include file="/page/enterprise/head_nav.jsp"%>
<div class="clearfix" style="background-color: seashell;margin-top: -20px">
    <c:if test="${empty requestScope.page.item}">
        暂无鲜花产品
       <a href="page/enterprise/editFlower.jsp"> 去添加</a>
    </c:if>
    <c:if test="${not empty requestScope.page.item}">
        <c:forEach items="${requestScope.page.item}" var="flower">
        <div class="card con" style="width: 27rem;margin-top: 20px;margin-bottom: 20px;">
            <img height="210px" src="static/picFlower/${flower.flower_photo}" class="card-img-top" alt="鲜花照片">
            <div class="card-body">
                <h4 class="card-title">编号 ${flower.flowerid} </h4>
                <div style="height: 90px;margin-bottom: 5px;margin-top: 5px">[&nbsp;名称&nbsp;]&nbsp;&nbsp;${flower.flower_name}</div>
                <div style="height: 200px">[&nbsp;介绍&nbsp;]&nbsp;&nbsp;<span style="font-size: 14px;letter-spacing: 2px">${flower.introduce}</span></div>
            </div>
            <ul class="list-group list-group-flush" style="margin-bottom: 0px">
                <li class="list-group-item">销售量：${flower.sales} &nbsp;&nbsp;&nbsp; 库存：${flower.stock}</li>
                <li class="list-group-item">￥${flower.price}</li>
            </ul>
            <div class="card-footer">
                <a href="enterprise/flowerServlet?action=getFlower&flowerid=${flower.flowerid}" class="card-link">修改&nbsp;&nbsp;&nbsp;</a>
                <input type="hidden" name="id" value="${flower.flowerid}">
                <a href="enterprise/flowerServlet?action=delete&flowerid=${flower.flowerid}" class="deleteClass card-link">&nbsp;&nbsp;&nbsp;删除</a>
                <a href="page/enterprise/modifyFlowerPhoto.jsp?flowerid=${flower.flowerid}">&nbsp;&nbsp;&nbsp;更换图片</a>
            </div>
        </div>
        </c:forEach>
    </c:if>
</div>
<div id="footpage" style="background-color: #86cfda;margin-top: 5px"><%@include file="/page/comment/page_nav.jsp"%></div>
</body>
<script type="text/javascript">
    $(function () {
        //在事件的function函数中，有一个this对象，该对象是当前正在响应事件的DoM对象
        $("a.deleteClass").click(function () {
           if(confirm("确定要删除【"+$(this).parent().find("input:hidden").val()+"】吗？")){
               alert("已删除")
           }else{
               return false;
           }
        })
    })
</script>
</html>
